package com.PAT.UnSatisfying;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/11/17:55
 * @Description:
 * @Target: 内存超限 差3
 */
public class 外观数列 {


    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String ss = in.next();
        int len = in.nextInt();
        for (int i = 1; i < len; i++) {
            ss = describe(ss);
        }

        System.out.println(ss);
    }

    static String describe(String s){
        int count = 1;
        String newString = "";
        newString += s.charAt(0);
        for(int i = 1; i < s.length();i++){
            if(s.charAt(i)==s.charAt(i-1)){
                count++;
            }else{
                newString += count;
                newString += s.charAt(i);
                count = 1;
            }
        }

        if(count!=0){
            newString += count;
        }

        return newString;
    }

}
